(function() {
    Nokia.TextLabel = Nokia.Widget.extend({
        initialize: function(options) {
            var instance = this;

			var defaults = {
				content: ''
            };

            instance.options = jQuery.extend(defaults, options);

            instance.element = jQuery( instance.options.element );

            instance._super.apply(instance, [instance.options]);

            instance._create();

			instance.options.content = jQuery(instance.options.content);

			instance.setContent(instance.options.content);

			instance.registerVibrationOn([ ]);

			instance.fireCallback('create');
        },

		setContent: function(value) {
			var instance = this;
			var val = jQuery(value);

			var isNode = val[0] && val[0].nodeType && val[0].cloneNode;

			if (value) {

				if (isNode) {
					val.show();
				}

				instance.content = value;
				instance.element.html(
					instance.getContent()
				);
			}
		},

		getContent: function() {
			var instance = this;
			return instance.content;
		},

		_create: function() {
			var instance = this;
			var options = instance.options;
			var element = instance.element;
			var Styles = instance.Styles;

			instance.element.addClass([
				Styles.textLabel,
				Styles.widget,
				Styles.widgetContent,
				Styles.cornerAll
			].join(' '));

			if (options.style) {
				instance.element.css(options.style);
			}
		},

		Styles: {
			textLabel: 'nokia-text-label',
			widget: 'ui-widget',
			widgetContent: 'ui-widget-content',
			cornerAll: 'ui-corner-all'
		}
    });
})();